<?php
/**
 * Created by PhpStorm
 * author: bxm
 * Date: 2023/3/8
 * Time: 11:47
 */

namespace app\admin\model;

use app\common\model\TimeModel;

class Task  extends TimeModel
{
    protected $name = "task";

    protected $deleteTime = "delete_time";



    // 设置json类型字段，你需要将字段名称和别名一起加入
//    protected $json = ['back_files','upload_imgs','cost_files'];
//
//    // 设置JSON数据返回数组
//    protected $jsonAssoc = true;
    //任务发起人
    public function createAdmin()
    {
        return $this->belongsTo('app\common\model\AdminModel','admin_id','id')->field(['id,nickname']);
    }
    public function auditAdmin()
    {
        return $this->belongsTo('app\common\model\AdminModel','audit_admin_id','id')->field(['id,nickname']);
    }

    public function receiveAdmin()
    {
        return $this->belongsTo('app\common\model\AdminModel','receive_admin_id','id')->field(['id,nickname']);
    }

//    public function copyAdmin()
//    {
//        return $this->belongsTo('app\common\model\AdminModel','copy_admin_ids','id')->field(['id,nickname']);
//    }

    public function taskCustomer()
    {
        return $this->belongsTo('app\common\model\worker\CustomerModel','customer_id','id')->field(['id,name']);
    }
}